package com.flea.hclv.controller;

import com.flea.hclv.model.entity.HCar;
import com.flea.hclv.model.entity.HCarAgency;
import com.flea.hclv.model.entity.HCarAgencyItem;
import com.flea.hclv.service.HCarAgencyService;
import com.flea.hclv.util.ServerResponse;
import com.flea.system.bean.FleaPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: project
 * @description: 车辆下单代办
 * @author: shiliqiang
 * @create: 2019-03-03 15:08
 * @version: 1.0
 */
@Controller
@RequestMapping("/flea/hclv/car/agency/")
public class HCarAgencyController {

    @Autowired
    private HCarAgencyService hCarAgencyService;

    @ResponseBody
    @RequestMapping("add")
    public ServerResponse<String> addAgency(HttpServletRequest request,String model) throws Exception {
        ServerResponse<String> response = hCarAgencyService.addAgency(request,model);
        return response;
    }
    @ResponseBody
    @RequestMapping("selectAll")
    public ServerResponse<FleaPage<HCarAgency>> selectAll(HttpServletRequest request, FleaPage<HCarAgency> paging) {
        ServerResponse<FleaPage<HCarAgency>> response = hCarAgencyService.selectAll(request,paging);
        return response;
    }
    //获取订单项（根据订单号（预定信息ID）车辆列表）
    @RequestMapping("getCarAgencyItem")
    @ResponseBody
    public ServerResponse<FleaPage<HCarAgencyItem>> getReserveCarItem(HttpServletRequest request, FleaPage<HCar> paging,
                                                                      String carAgencyId){
        ServerResponse<FleaPage<HCarAgencyItem>> response = hCarAgencyService.getReserveCarItem(paging,carAgencyId);
        return response;
    }
    //获取符合条件的车
    @RequestMapping("getRequireCars")
    @ResponseBody
    public ServerResponse<FleaPage<HCar>> getRequireCars(HttpServletRequest request, FleaPage<HCar> paging,
                                                         String model){
        ServerResponse<FleaPage<HCar>> response = hCarAgencyService.getRequireCars(request,paging,model);
        return response;
    }




}
